<template>
  <a-modal title="查看" :width="1200" :visible="visible" cancelText="关闭" @cancel="onClose">
    <a-table
      rowKey="id"
      bordered
      size="middle"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :scroll="{ x: '${columns.length}0%', y: 1000 }"
      @change="handleTableChange"
    >
    </a-table>
    <template slot="footer">
      <a-button @click="onClose">关闭</a-button>
    </template>
  </a-modal>
</template>

<script>
import ARow from 'ant-design-vue/es/grid/Row'
import ACol from 'ant-design-vue/es/grid/Col'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { mixinDevice } from '@/utils/mixin'

export default {
  name: 'RoleDataruleModal',
  mixins: [JeecgListMixin, mixinDevice],
  components: { ACol, ARow },
  data() {
    return {
      dataSource: [],
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 50,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '序号',
          align: 'center',
          dataIndex: 'serial',
          width: 50,
        },
        {
          title: '选择',
          align: 'center',
          dataIndex: 'choice',
          width: 60,
        },
        {
          title: '客户编码',
          align: 'center',
          dataIndex: 'customerCode',
          width: 100,
        },
        {
          title: '客户名称',
          align: 'center',
          dataIndex: 'customerName',
          width: 100,
        },
        {
          title: '客户简称',
          align: 'center',
          dataIndex: 'customerShort',
          width: 100,
        },
        {
          title: '最后一次下单时间',
          align: 'center',
          dataIndex: 'lastDate',
          customRender: function (text) {
            return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
          },
          width: 100,
        },
        {
          title: '上样',
          align: 'center',
          dataIndex: 'memo',
          width: 100,
        },
        {
          title: '客户分类名称',
          align: 'center',
          dataIndex: 'addressType',
          width: 100,
        },
        {
          title: '地区名称',
          align: 'center',
          dataIndex: 'area',
          width: 100,
        },
        {
          title: '地址',
          align: 'center',
          dataIndex: 'address',
          width: 120,
        },
        {
          title: '发展日期',
          align: 'center',
          dataIndex: 'devDate',
          width: 100,
          customRender: function (text) {
            return !text ? '' : text.length > 10 ? text.substr(0, 10) : text
          },
        },
        {
          title: '建档人',
          align: 'center',
          dataIndex: 'createName',
          width: 100,
        },
        {
          title: '内销客户等级',
          align: 'center',
          dataIndex: 'level',
          width: 100,
        },
        {
          title: '发货地址1',
          align: 'center',
          dataIndex: 'openAddress',
          width: 200,
        },
        {
          title: '发货地址2',
          align: 'center',
          dataIndex: 'openAddressTwo',
          width: 200,
        },
        {
          title: '大类',
          align: 'center',
          dataIndex: 'type',
          width: 100,
        },
        {
          title: '余额',
          align: 'center',
          dataIndex: 'memoy',
          width: 60,
        },
        {
          title: '信用额度',
          align: 'center',
          dataIndex: 'xingyong',
          width: 60,
        },
        {
          title: '客户级别编码',
          align: 'center',
          dataIndex: 'memo2',
          width: 60,
        },
        {
          title: '客户级别名称',
          align: 'center',
          dataIndex: 'memo3',
          width: 60,
        },
        {
          title: '币种',
          align: 'center',
          dataIndex: 'memo4',
          width: 60,
        },
        {
          title: '潜在客户编码',
          align: 'center',
          dataIndex: 'memo5',
          width: 60,
        },
        {
          title: '税率%',
          align: 'center',
          dataIndex: 'memo6',
          width: 60,
        },
        {
          title: '创建时间',
          align: 'center',
          dataIndex: 'createTime',
          width: 100,
        },
      ],
      visible: false,
      url: {
        list: '/customerReport/getListOtherByxy',
      },
    }
  },
  methods: {
    show1(record) {
      this.visible = true
      this.queryParam.x = record.x
      this.queryParam.y = record.y
      this.queryParam.lastDateBegin = record.lastDateBegin
      this.queryParam.lastDateEnd = record.lastDateEnd
      this.queryParam.xx = null
      this.queryParam.yy = null
      this.loadData(1)
    },
    show2(record) {
      this.visible = true
      this.queryParam.xx = record.xx
      this.queryParam.yy = record.yy
      this.queryParam.lastDateBegin = record.lastDateBegin
      this.queryParam.lastDateEnd = record.lastDateEnd
      this.queryParam.x = null
      this.queryParam.y = null
      this.loadData(1)
    },

    onClose() {
      this.visible = false
    },
  },
}
</script>

<style scoped>
</style>